// 引入地址、端口、一级路由
import {
  address,
  pathApi
} from "@/api/path";
// 引入 axios
import axios from "axios";
// axios.defaults.withCredentials = true
// 首页查询

// startTime开始时间 endTime截止时间
const queryData = (condition, callback) => {
  condition.loginType = 2;
  // appBs (1 超户 0 普通用户)
  axios({
    data: {
      DsName: condition.DsName,
      startTime: condition.startTime,
      endTime: condition.endTime,
      idclerk: condition.idclerk,
      appBs: condition.appBs,
      // startTime:"",
      // endTime:"",
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/SASaleOrder/findSaleOrderMoney`
  }).then(function (res) {
    callback(res.data)
  }).catch(() => {
  });
}
// 查询客户排名
// status  1订单金额 2发货金额 3收款金额
const findMoneyByCustomer = (condition, callback) => {
  condition.loginType = 2;
  axios({
    data: {
      DsName: condition.DsName,
      startTime: condition.startTime,
      endTime: condition.endTime,
      idclerk: condition.idclerk,
      page: condition.page,
      limit: condition.limit,
      number: condition.status,
      appBs: condition.appBs,
    },
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    url: `${address}${pathApi}/SASaleOrder/findMoneyByCustomer`
  }).then(function (res) {
    callback(res.data)
  }).catch(() => {
  });
}

export {
  queryData,
  findMoneyByCustomer,
}
